import request from '@/utils/request'

export function getParkListAPI(params) {
  return request({
    url: '/park/enterprise',
    method: 'get',
    params
  })
}

/**
 * 获取企业所属行业列表
 *
 */

export function getIndustryListAPI() {
  return request({
    url: '/park/industry'
  })
}

/**
 * 上传 图片 文件 接口
 * @file file
 * @type  string
 */
export function uploadAPI(data) {
  return request({
    url: '/upload',
    method: 'post',
    data
  }
  )
}

/**
 * 增加企业
 * @data 需要传参
 */
export function addParkAPI(data) {
  return request({
    url: '/park/enterprise',
    method: 'post',
    data
  })
}

/**
 * 获取企业详情
 */
export function getParkDetailAPI(id) {
  return request({
    url: `/park/enterprise/${id}`,
    method: 'get'
  })
}

/**
 * 编辑企业
 * @param data 需要传参
 *
 */
export function editParkAPI(data) {
  return request({
    url: '/park/enterprise',
    method: 'put',
    data
  })
}

/**
 *删除企业
 * @param id
 *
*/
export function deleteParkAPI(id) {
  return request({
    url: `/park/enterprise/${id}`,
    method: 'DELETE'
  })
}

/**
 * 获取企业租赁信息列表
 * @params {String} id 企业id
 */
export const getCompanyRentalList = () => request({
  url: '/park/rent/building',
  method: 'get'
})

/**
 * 创建合同
 * @params {Object} data
 */

export const createContract = (data) => request({
  url: '/park/enterprise/rent',
  method: 'post',
  data
})

/**
 * 获取当前企业租赁信息列表
 * @params {String} id 企业id
 */

export const getCurrentCompanyRentalList = (id) => request({
  url: `/park/enterprise/rent/${id}`,
  method: 'get'
})

// 退租
export const cancelRentAPI = (id) => {
  return request({
    url: `/park/enterprise/rent/${id}`,
    method: 'put'
  })
}

// 删除租赁合同
export const deleteParkRentAPI = (id) => {
  return request({
    url: `/park/enterprise/rent/${id}`,
    method: 'DELETE'
  })
}

// 查看企业租赁信息
export const getParkRentDetailAPI = (id) => request({
  url: `/park/enterprise/rent/${id}`,
  method: 'get'
})

